package com.alex.algorithm.easy;

public class SingleNum {

    public static void main(String[] args) {
        System.out.println(single(new int[]{4,1,2,1,2}));
    }

    public static int single(int[] arr) {
        int ret = 0;
        for (int i = 0; i < arr.length; ++i) {
            ret = ret ^ arr[i];
        }
        return ret;
    }
}
